#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
	int n,s_f;
	char s[25],s_t[25];//s名字,s_f分数,s_t保存
	cin>>n;
	int len;
	int max=-INF;
	
	for (int i=0;i<=n;i++)
	{
		cin>>s_f>>s;
		len=strlen(s);
		if (s_f>max)
		{
			max=s_f;
			strcpy(s_t,s);
		}
	}
	cout<<s_t;
	
	return 0;
}